package com.zx.mes.test.hyl.model.singleton;

/**
 * 双重锁单例模式
 * @author hyl
 * @date 2018-3-28
 */
public class Singleton3 {

    private static volatile Singleton3 instance;

    private Singleton3(){}

    public static Singleton3 getInstance(){
        if (instance == null) {
            synchronized (Singleton3.class){
                if (instance == null) {
                    instance = new Singleton3();
                }
            }
        }
        return instance;
    }
}
